<extend name="Base/common"/>

<block name="style">
    <link href="__CSS__/recharge.css" rel="stylesheet" type="text/css"/>
</block>
<block name="header">
    <include file="Public/_nav"/>
</block>
<block name="body">
    <div class="common-block">
        <section>
            <div class="row">
                <div class="col-xs-12">
                    <p>&nbsp;</p>
                    <h4>{:L("_RECHARGE_CENTER_")}</h4>
                    <hr class="oneuser-title-hr"/>
                </div>
            </div>
            <include file="_menu"/>
            <div style="margin-bottom: 50px">
                <h3 style="font-size: 16px;font-weight: bold">{:L("_SELECT_RECHARGE_TYPE_")}</h3>
                <hr/>
                <p>
                <blockquote>
                    <volist name="fields" id="vo">
                        <br/>
                        <label><input data-role="set_field" type="radio" name="field" value="{$vo.FIELD}"
                            <eq name="i" value="1">checked</eq> >{:L("_CURRENT_RECHARGE_RATE_")}1 RMB = {$vo.UNIT} {$vo.scoreType.unit} {$vo.scoreType.title}
                            {:L("_ACCOUNT_BALANCE_WITH_COLON_")}<span style="color: red">{$vo.have} </span> {$vo.scoreType.unit} {$vo.scoreType.title} ）</label>
                    </volist>
                </blockquote>
                </p>
            </div>
            <div style="margin-bottom: 30px">
                <h3 style="font-size: 16px;font-weight: bold">{:L("_SELECT_PREPAID_AMOUNT_")}</h3>
                <hr/>
                <div>
                    <form class="form-horizontal">

                        <php>if($amount){</php>
                        <div class="row">
                            <div class="col-md-2">
                              {:L("_RECHARGE_AMOUNT_WITH_SPACE_")}
                            </div>
                            <div class="col-md-8">
                                <div class="radio">
                                    <volist name="amount" id="vo">
                                        <if condition="floatval($vo) neq 0">

                                            <div class="form-group">
                                                <label><input  data-role="set_amount"   name="amount" type="radio" value="{$vo|floatval}"
                                                    <eq name="i" value="1">checked</eq> > {$vo|floatval}
                                                    元 </label>
                                            </div>

                                            <else/>

                                        </if>
                                    </volist>
                                </div>
                            </div>

                        </div>

                        <php>}</php>
                        <if condition="modC('CAN_INPUT',1,'recharge')">
                            <div class="row">
                                <div class="col-md-2">
                                  {:L("_ARBITRARY_AMOUNT_WITH_SPACE_")}
                                </div>
                                <div class="col-md-8">
                                    <div class="form-group">
                                        <label><input id="other" onfocus="$(this).next().focus()" name="amount" type="radio" value="{$vo|floatval}">&nbsp;&nbsp;
                                            <input type="text" class="form-control "
                                                   onfocus="$('#other').prop('checked',true);$('#frm_amount').val(0)"
                                                   style="display: inline-block;width: 120px" name="amount" value=""
                                                   placeholder={:L("_INPUT_AMOUNT_WITH_DOUBLE_")}
                                                   onblur="$('#frm_amount').val(parseFloat($(this).val()))"
                                                    >&nbsp; 元
                                            <if condition="modC('MIN_AMOUNT',0,'recharge') neq 0">
                                                {:L("_MINIMUM_CHARGE_")}{:modC('MIN_AMOUNT',0,'recharge')} 元）
                                            </if>

                                        </label>

                                    </div>
                                </div>
                            </div>
                        </if>

                    </form>

                </div>

            </div>
            <div>
                <h3 style="font-size: 16px;font-weight: bold">{:L("_SELECT_PAYMENT_METHOD_")}</h3>
                <hr/>
                <div style="padding: 20px">
                    <if condition="check_is_in_config('alipay',$method)">
                        <label><input type="radio" name="type" value="alipay" checked>
                            <img src="__IMG__/alipay.gif"/>
                        </label>
                    </if>

                </div>

            </div>
            <div style="margin-bottom: 30px">
                <div class="clearfix">
                    <form action="{:U('recharge')}" method="post">
                        <input id="frm_amount" type="hidden" name="amount" value="{$amount.0|floatval}">
                        <input type="hidden" name="method" value="{$method.0}">
                        <input id="frm_field" type="hidden" name="field" value="{$fields.0.FIELD}">
                        <button class="btn btn-primary pull-left" type="submit">{:L("_SUBMIT_ORDERS_")}</button>
                    </form>
                </div>

            </div>
        </section>

    </div>

<script>
    $(function(){
        $('[data-role="set_field"]').change(function(){
            $('#frm_field').val($(this).val());
        })

        $('[data-role="set_amount"]').change(function(){
            $('#frm_amount').val($(this).val());
        })
    })

</script>
</block>

